import { $post, $get, $put } from '../utils/request'

// 通过账号来登录的第一个接口
export const LOGIN_BY_ACCOUNT_FIRST = params =>
  $post('/store-platform/shop/loginShopByAccountFirst', params)

// 上面返回结果集合大于2才调用
export const LOGIN_BY_ACCOUNT_NEXT = params =>
  $post('/store-platform/shop/loginShopByAccount', params)

// 通过绑定的手机号加验证码来修改密码
export const UPDATE_PASSWORD_BY_PHONE = params =>
  $post('/store-platform/shop/chPasswordByValidate', params)

// 旧密码来修改密码
export const UPDATE_PASSWORD_BY_PASSWORD = params =>
  $post('/store-platform/shop/chPasswordByOld', params)

// 发送短信
export const SEND_MESSAGE = (params, messageTemp) =>
  $post('/store-platform/message/sendMessage', params, { messageTemp })

// 发送短信
export const SEND_MESSAGE2 = (params, messageTemp) =>
  $post('/app-api/sendMessage', params, { messageTemp })

// 店铺退出登录
export const LOGOUT = token =>
  $post('/store-platform/shop/shopLoginOut', null, { token })

// 更新店铺
export const SHOP_UPDATE_SHOP = params =>
  $post('/store-platform/shop/updateShop', params)

/* **************************************************************** */

// 校验管理员
export const CHECK_ADMIN = username =>
  $get('/store-platform/api/shop/admin/check/' + username)

// 用户名密码登录
export const ADMIN_LOGIN = params =>
  $post('/store-platform/api/shop/admin/login', params)

// 登出
export const NEW_LOGOUT = () => $get('/store-platform/api/shop/admin/logout')

// 修改昵称和密码
export const UPDATA_NAME_AND_PASS = params =>
  $put('/store-platform/shop/admin/modify', params)

// 店铺发短信修改密码
export const UNDATE_PWD_BY_CODE = params =>
  $put('/store-platform/api/shop/admin/updatePwdByCode', params)
